import React from 'react';
import {Text, StyleSheet} from 'react-native';
import {Flex} from '@ant-design/react-native';
import NumbericInput from 'react-native-numeric-input';

const styles = StyleSheet.create({
  labelText: {
    marginRight: 10,
  },
});
export default function NumbericInputItem({
  value,
  label,
  minValue,
  maxValue,
  onChange,
  ...textInputProps
}) {
  return (
    <Flex>
      <Text style={styles.labelText}>{label}</Text>
      <NumbericInput
        initValue={value}
        value={value}
        minValue={minValue}
        maxValue={maxValue}
        editable={minValue < maxValue}
        onChange={onChange}
        borderColor="#fbf2d4"
        rounded
        {...textInputProps}
      />
    </Flex>
  );
}
